__author__ = 'yaojian'

from usermanage.account.models import User
from models import UserContact, UserContactType

def get_user_profile(_user):
    if _user and isinstance(_user, User):
        _vqs_contacts = UserContact.objects.filter(user = _user).values_list('type', 'value')
        for _type, _value in _vqs_contacts:
            if _type == UserContactType.Mobile1:
                _user.mobile1 = _value
            elif _type == UserContactType.Mobile2:
                _user.mobile2 = _value
            elif _type == UserContactType.Mobile3:
                _user.mobile3 = _value
            elif _type == UserContactType.Email:
                _user.email = _value
        return _user
    else:
        return  None